package ex9;

import java.util.Scanner;
public class Test1 {
	public static void main(String[] args) {
		int a[] = new int[5];
		Scanner scanner = new Scanner(System.in);
		while (scanner.hasNextLine()) {
			try {
				String string = scanner.nextLine();
				if (string.contains("arr")) {
					String[] strings = string.split(" ");
					int x = Integer.parseInt(strings[1]);
					x = a[x];
				} else if (string.equals("null")) {
					throw new NullPointerException();
				} else if (string.equals("cast")) {
					throw new ClassCastException("java.lang.String cannot be cast to java.lang.Integer");
				} else if (string.contains("num")) {
					String[] strings = string.split(" ");
					Integer.parseInt(strings[1]);
				} else {
					break;
				}
			} catch (Exception e) {
				// TODO: handle exception
				System.out.println(e);
			}
		}
		scanner.close();

	}
}
